<%--
  Created by IntelliJ IDEA.
  User: CY
  Date: 2017/12/25
  Time: 10:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新建报送</title>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ? MYOA_CHARSET : htmlspecialchars($HTML_PAGE_CHARSET))?>" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" type="text/css" href="../../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" type="text/css" href="/css/patrol/patrol.css"/>
    <script src="../js/jquery/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../lib/layer/layer.js?20201106"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>

    <style>
        .header{
            width:100%;
            height:45px;
            border-bottom:1px solid #9E9E9E;
            position:fixed;
            top:0px;
            z-index: 100;
            background: #fff;
        }
        .nav{
            overflow:hidden;
        }
        .nav li{
            height:28px;
            line-height:28px;
            float:left;
            font-size:14px;
            margin-left:20px;
            margin-top:6px;
            cursor:pointer;
        }
        .space{
            width:2px;
            margin-left:16px;
        }
        .pad{
            padding:3px 10px;
            line-height:28px;
        }
        .select{
            background-color:#2F8AE3;
            color:#fff;
            border-radius:20px;
            -webkit-border-radius:20px;
            -moz-border-radius:20px;
            -o-border-radius:20px;;
            -ms-border-radius:20px;
        }
        select{
            border-radius: 3px;
            height:28px;
            margin-left:20px;
        }
        #query{
            background: #00a0e9;
            margin-left: 10px;
            padding: 3px 10px;
            border-radius: 4px;
            color: #fff;
            cursor: pointer;
        }
        .add{
            float: right;
            display: inline-block;
            background-color: #2f80d1;
            margin-top: -27px;
            margin-right: 30px;
            font-size: 14px;
            cursor: pointer;
            border: #ccc 1px solid;
            color: #fff;
            border-radius: 5px;
            text-align: center;
            line-height: 28px;
            height: 28px;
            width: 70px;
        }
        .edui-default .edui-editor{
            width:100%!important;
        }
        .M-box3 .active{
            margin: 0px 3px;
            width: 29px;
            height: 29px;
            line-height: 29px;
            background: #2b7fe0;
            font-size: 12px;
            border: 1px solid #2b7fe0;
            color:#fff;
            text-align:center;
            display: inline-block;
        }
        .M-box3 a{
            margin: 0 3px;
            width: 29px;
            height: 29px;
            line-height: 29px;
            font-size: 12px;
            display: inline-block;
            text-align:center;
            background: #fff;
            border: 1px solid #ebebeb;
            color: #bdbdbd;
            text-decoration: none;
        }
        .jump-btn:hover{
            background: #2b7fe0!important;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="header">
        <ul class="nav">
            <li url="/vote/manage/voteList">
                <span class="select pad">新建报送</span>
                <img class="space" src="../../img/twoth.png" alt="">
            </li>
        </ul>
        <span class="add choose" data-type="0" type="0" id="add">新建</span>
    </div>
    <div class="content" >
        <div class="conList" style="padding-top:50px;" id="conList">
            <div style="height:50px;line-height: 50px;">
                <select name="" id="allDept" >
                    <option value="">是否采集</option>
                    <option value="1">是</option>
                    <option value="0">否</option>
                </select>
                <button id="query">查询</button>
            </div>
            <div style="margin: -45px auto 0px;height:50px;width: 97%;" class="clearfix">
                <div id="dbgz_page" class="M-box3">

                </div>
            </div>
            <div class="table">
                <table style="width:98%;margin:0 auto">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>填报部门</th>
                        <th>填报人</th>
                        <th>报送人</th>
                        <th>报送时间</th>
                        <th>标题</th>
                        <th>是否采集</th>
                        <th>是否阅读</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody class="list">

                    </tbody>
                </table>
            </div>
        </div>
        <div style="width:100%;height:100%;display: none;" class="iframe" id="info">
            <div style="padding-top:50px;">
                <iframe vote_id="0" id="iframe" src="" frameborder="0" style="width:100%;height:calc(100% - 50px);padding-top:0px;"></iframe>
            </div>
        </div>
    </div>

</div>
<script>
    <%--点击切换--%>
    $(document).on('click','.choose',function(){
        var me=$(this);
        $('.iframe').show();
        $('.conList').hide();
        $('.add').hide();
        if(me.attr('data-type')==0){
            $('#iframe').attr('src','/infomation/infoDetail?dataType='+me.attr('data-type')+'&type='+me.attr('type'))
        }else if(me.attr('data-type')==1){
            var id=me.parents('tr').attr('id');
            $('#iframe').attr('src','/infomation/infoDetail?dataType='+me.attr('data-type')+'&type='+me.attr('type')+'&id='+id)
        }

    })
//    点击查看详情
    $('.list').on('click','.detail',function(){
        var me=$(this);
        $('.iframe').show();
        $('#conList').hide();
        $('.add').hide();
        $('.preservation').hide();
        var id=me.parents('tr').attr('id');
        $('#iframe').attr('src','/infomation/infoDetail?dataType='+me.attr('data-type')+'&type='+me.attr('type')+'&id='+id);
    })
//    分页列表
    var ajaxPageLe={
        data:{
            page:1,//当前处于第几页
            pageSize:10,//一页显示几条
            iscollection:"",
            useFlag:true
        },
//        init:function(){
//            $.ajax({
//                url:'/department/getAlldept',
//                type:'get',
//                dataType:'json',
//                success:function(res){
//                    var data=res.obj;
//                    var str="<option value=''>所有部门</option>";
//                    for(var i=0;i<data.length;i++){
//                        str += '<option value="'+data[i].deptId+'">'+data[i].deptName+'</option>'
//                    }
//                    $('#allDept').html(str)
//                }
//            })
//        },
        page:function () {
            var me=this;
            $.ajax({
                url:'/infomation/getInformationList',
                type:'get',
                data:me.data,
                dataType:'json',
                success:function(reg){
                    var data=reg.obj;
                    var str="";
                    if(data.length<=0){
                        $.layerMsg({content:'暂无信息',icon:6})
                    }else{
                        for(var i=0;i<data.length;i++){
                            var time=new Date(data[i].createTime).Format('yyyy-MM-dd hh:mm:ss')
                            str+='<tr id="'+data[i].id+'">' +
                                '                        <td>'+(i+1)+'</td>' +
                                '                        <td>'+data[i].deptName+'</td>' +
                                '                        <td>'+data[i].userName+'</td>' +
                                '                        <td>'+isEmpty(data[i].deliveryDeptName)+'</td>' +
                                '                        <td>'+time+'</td>' +
                                '                        <td>'+data[i].title+'</td>' +
                                '                        <td>'+function(){
                                    if(data[i].iscollection==0){
                                        return '否'
                                    }else{
                                        return '是'
                                    }
                                }()+'</td>' +
                                '                        <td>'+function(){
                                    if(data[i].isread==0){
                                        return '否'
                                    }else{
                                        return '是'
                                    }
                                }()+'</td>' +
                                '                        <td>' +function(){
                                    if(data[i].sign==0){
                                        return ''
                                    }else{
                                        return '<a href="javascript:;" class="choose" data-type="1" type="0">修改</a>'
                                    }
                                }() +
                                '                            <a href="javascript:;" class="detail" data-type="2" type="0">查看详情</a>' +
                                '                        </td>' +
                                '                    </tr>'
                        }

                    }

                    me.pageTwo(reg.totleNum,me.data.pageSize,me.data.page)
                    $('.list').html(str);
                }
            })

        },
        pageTwo:function (totalData, pageSize,indexs) {
            var mes=this;
            $('#dbgz_page').pagination({
                totalData: totalData,
                showData: pageSize,
                jump: true,
                coping: true,
                homePage:'',
                endPage: '',
                current:indexs||1,
                callback: function (index) {
                    mes.data.page=index.getCurrent();
                    mes.page();
                }
            });
        }
    }
    ajaxPageLe.page();
//    ajaxPageLe.init();
    $('#query').click(function(){
        ajaxPageLe.data.iscollection=$('#allDept option:selected').val();
        ajaxPageLe.page();
    })

    //判断字符是否为空的方法
    function isEmpty(obj){
        if(obj == undefined || obj == "" || obj == null){
            return '';
        }
        return obj;
    }
</script>
</body>
</html>
